<template>
  <el-dialog title="编辑" :visible="visible" width="40%" @close="close">
    <el-form
      :model="form"
      ref="form"
      label-width="80px"
      :inline="false"
      size="small"
    >
      <el-form-item label="制造单元">
        <!-- <el-input v-model="form.manufactureSite"></el-input> -->
        <el-select
          class="w100"
          v-model="form.manufactureSite"
          value-key=""
          placeholder=""
          filterable
          @change=""
        >
          <el-option
            v-for="item in manufactureSiteList"
            :key="item.name"
            :label="item.name"
            :value="item.name"
          >
          </el-option>
        </el-select>
      </el-form-item>
    </el-form>

    <span slot="footer">
      <el-button size="small" @click="close">关 闭</el-button>
      <el-button type="primary" size="small" @click="sumbmit" :loading="loading"
        >确 定</el-button
      >
    </span>
  </el-dialog>
</template>
<script>
import { mapGetters } from "vuex";
import { editTemplateToken } from "@/api/technology";
export default {
  props: {
    visible: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    ...mapGetters(["manufactureSiteList"])
  },
  data() {
    return {
      form: {},
      loading: false
    };
  },
  methods: {
    close() {
      this.$emit("update:visible", false);
    },
    async sumbmit() {
      this.loading = true;
      try {
        await editTemplateToken(this.form, this.form.token);
        this.$msg({
          message: "编辑成功",
          type: "success"
        });
        this.loading = false;
        this.close();
        this.$emit("sumbmit");
      } catch (error) {
        this.loading = false;
      }
    }
  }
};
</script>
